3.6.14 \(\int \cos ^2(c+d x) (a+b \tan (c+d x)) \, dx\) [514]

Optimal. Leaf size=43 \[ \frac {a x}{2}-\frac {b \cos ^2(c+d x)}{2 d}+\frac {a \cos (c+d x) \sin (c+d x)}{2 d} \]

[Out]

1/2*a*x-1/2*b*cos(d*x+c)^2/d+1/2*a*cos(d*x+c)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 43, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3567, 2715, 8} \begin {gather*} \frac {a \sin (c+d x) \cos (c+d x)}{2 d}+\frac {a x}{2}-\frac {b \cos ^2(c+d x)}{2 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + b*Tan[c + d*x]),x]

[Out]

(a*x)/2 - (b*Cos[c + d*x]^2)/(2*d) + (a*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 3567

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*((d*Sec[
e + f*x])^m/(f*m)), x] + Dist[a, Int[(d*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e, f, m}, x] && (IntegerQ[2
*m] || NeQ[a^2 + b^2, 0])

Rubi steps

\begin {align*} \int \cos ^2(c+d x) (a+b \tan (c+d x)) \, dx &=-\frac {b \cos ^2(c+d x)}{2 d}+a \int \cos ^2(c+d x) \, dx\\ &=-\frac {b \cos ^2(c+d x)}{2 d}+\frac {a \cos (c+d x) \sin (c+d x)}{2 d}+\frac {1}{2} a \int 1 \, dx\\ &=\frac {a x}{2}-\frac {b \cos ^2(c+d x)}{2 d}+\frac {a \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.07, size = 46, normalized size = 1.07 \begin {gather*} \frac {a (c+d x)}{2 d}-\frac {b \cos ^2(c+d x)}{2 d}+\frac {a \sin (2 (c+d x))}{4 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + b*Tan[c + d*x]),x]

[Out]

(a*(c + d*x))/(2*d) - (b*Cos[c + d*x]^2)/(2*d) + (a*Sin[2*(c + d*x)])/(4*d)

________________________________________________________________________________________

Maple [A]
time = 0.20, size = 41, normalized size = 0.95

method result size
risch \(\frac {a x}{2}-\frac {b \cos \left (2 d x +2 c \right )}{4 d}+\frac {a \sin \left (2 d x +2 c \right )}{4 d}\) \(36\)
derivativedivides \(\frac {-\frac {b \left (\cos ^{2}\left (d x +c \right )\right )}{2}+a \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(41\)
default \(\frac {-\frac {b \left (\cos ^{2}\left (d x +c \right )\right )}{2}+a \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(41\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(-1/2*b*cos(d*x+c)^2+a*(1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c))

________________________________________________________________________________________

Maxima [A]
time = 0.52, size = 38, normalized size = 0.88 \begin {gather*} \frac {{\left (d x + c\right )} a + \frac {a \tan \left (d x + c\right ) - b}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*((d*x + c)*a + (a*tan(d*x + c) - b)/(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Fricas [A]
time = 0.39, size = 35, normalized size = 0.81 \begin {gather*} \frac {a d x - b \cos \left (d x + c\right )^{2} + a \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(a*d*x - b*cos(d*x + c)^2 + a*cos(d*x + c)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan {\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+b*tan(d*x+c)),x)

[Out]

Integral((a + b*tan(c + d*x))*cos(c + d*x)**2, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 146 vs. \(2 (37) = 74\).
time = 0.51, size = 146, normalized size = 3.40 \begin {gather*} \frac {2 \, a d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 2 \, a d x \tan \left (d x\right )^{2} + 2 \, a d x \tan \left (c\right )^{2} - b \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, a \tan \left (d x\right )^{2} \tan \left (c\right ) - 2 \, a \tan \left (d x\right ) \tan \left (c\right )^{2} + 2 \, a d x + b \tan \left (d x\right )^{2} + 4 \, b \tan \left (d x\right ) \tan \left (c\right ) + b \tan \left (c\right )^{2} + 2 \, a \tan \left (d x\right ) + 2 \, a \tan \left (c\right ) - b}{4 \, {\left (d \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + d \tan \left (d x\right )^{2} + d \tan \left (c\right )^{2} + d\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

1/4*(2*a*d*x*tan(d*x)^2*tan(c)^2 + 2*a*d*x*tan(d*x)^2 + 2*a*d*x*tan(c)^2 - b*tan(d*x)^2*tan(c)^2 - 2*a*tan(d*x
)^2*tan(c) - 2*a*tan(d*x)*tan(c)^2 + 2*a*d*x + b*tan(d*x)^2 + 4*b*tan(d*x)*tan(c) + b*tan(c)^2 + 2*a*tan(d*x)
+ 2*a*tan(c) - b)/(d*tan(d*x)^2*tan(c)^2 + d*tan(d*x)^2 + d*tan(c)^2 + d)

________________________________________________________________________________________

Mupad [B]
time = 3.68, size = 31, normalized size = 0.72 \begin {gather*} \frac {a\,x}{2}-\frac {{\cos \left (c+d\,x\right )}^2\,\left (\frac {b}{2}-\frac {a\,\mathrm {tan}\left (c+d\,x\right )}{2}\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2*(a + b*tan(c + d*x)),x)

[Out]

(a*x)/2 - (cos(c + d*x)^2*(b/2 - (a*tan(c + d*x))/2))/d

________________________________________________________________________________________